package app.form.component;

import java.util.List;

public class CheckBox extends AbstractSelectComponent {
    private List<Float> items;
    public CheckBox (String name, String title, List<Float> items) {
        super(name, title, items);
    }
    @Override
    public String renderCSS () {
        return ".checkbox {"
                    + "padding: 5px 5px;"
                    + "overflow: hidden;"
                + "} "
                + ".checkbox_group {"
                    + "float: left;"
                    + "width: 200px;"
                    + "overflow: hidden;"
                + "} "
                + ".checkbox_item {"
                    + "width: 75px;"
                    + "display: inline-block;"
                    + "padding-top: 5px;"
                + "} ";
    }

    @Override
    protected String getType() {
        return "checkbox";
    }

    @Override
    protected String getItemHTML(Float value, int index) {
        String id = getName() + "_item_" + index;
        return "<div class='checkbox_item'>"
                + "<input type='checkbox' id='"+id+"' name='" + getName()/* + "[" + index + "]"*/
                + "' value='" + value.toString() + "' /><label for='"+id+"'>" + value.toString()
                + "</label></div>";
    }
}